﻿using DomainCommons.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OpenAI.Domain.Entities
{
    /// <summary>
    /// 聊天会话
    /// </summary>
    public class ChatSession : IHasCreationTime, IHasDeletionTime, ISoftDelete
    {
        public int Id { get; }
        /// <summary>
        /// 聊天标题
        /// </summary>
        public string? Title { get; set; } = "New Chat";
        /// <summary>
        /// 用户Id
        /// </summary>
        public Guid AppUserId { get; set; }


        public DateTime CreationTime { get; private set; }

        public DateTime? DeletionTime { get; private set; }

        public bool IsDeleted { get; private set; }
        public ChatSession()
        {
            this.CreationTime = DateTime.Now;
        }

        public ChatSession(Guid appUserId) : this()
        {
            this.AppUserId = appUserId;
        }
        public ChatSession(Guid appUserId,string title):this(appUserId)
        {
            this.Title = title;
        }

        

        public void SoftDelete()
        {
            this.IsDeleted= true;
            this.DeletionTime = DateTime.Now;
        }
    }
}
